package com.mayn.jst.task;

import java.util.List;

import com.mayn.jst.login.JdLoginAction;
import com.mayn.jst.login.TaobaoLoginAction;
import com.mayn.jst.shop.action.ShopAccountAction;
import com.mayn.jst.shop.action.ShopAction;
import com.mayn.jst.shop.model.ShopAccountModel;

/**
 * 对所有店铺帐号进行后台登陆，获取cookie
 * 
 * @author Administrator
 *
 */
public class AllShopLoginTask {

	public static void CheckAndLoginAll() {
		List<ShopAccountModel> shopAccountList = ShopAccountAction.getShopAccountList();
		for (int i = 0; i < shopAccountList.size(); i++) {
			int shopId = shopAccountList.get(i).getInt("SA_SHOP_ID");
			int shopType = ShopAction.getShopType(shopId);
			switch (shopType) {
			case 1:
				TaobaoLoginAction.checkAndSaveTaobaoLoginCookie(shopId);
				break;
			case 2:
				JdLoginAction.checkAndSaveJdLoginCookie(shopId);
				break;
			default:
				break;

			}

		}

	}
	
	public static void ForceLoginAll() {
		List<ShopAccountModel> shopAccountList = ShopAccountAction.getShopAccountList();
		for (int i = 0; i < shopAccountList.size(); i++) {
			int shopId = shopAccountList.get(i).getInt("SA_SHOP_ID");
			int shopType = ShopAction.getShopType(shopId);
			switch (shopType) {
			case 1:
				TaobaoLoginAction.ForceSaveTaobaoLoginCookie(shopId);
				break;
			case 2:
				break;
			default:
				break;

			}

		}

	}

}
